<template>
  <div>
    <!--头部-->
    <dx-header></dx-header>
    <!--banner-->
    <home-banner :List="bannerList"></home-banner>
    <!--热门职业-->
    <home-popular :List="popularList"></home-popular>
    <!--专业人才-->
    <home-professional :List="professionList"></home-professional>
    <!--热门人才-->
    <home-talent :List="talentList"></home-talent>
    <!--目标-->
    <home-goals></home-goals>
    <!--尾部-->
    <dx-footer></dx-footer>
  </div>
</template>
<script>
  import DxHeader from 'common/header/header'
  import DxFooter from 'common/footer/footer'
  import HomeBanner from '../home/component/banner'
  import HomePopular from '../home/component/popular'
  import HomeProfessional from '../home/component/professional'
  import HomeTalent from '../home/component/talent'
  import HomeGoals from '../home/component/goals'
  export default {
    name: 'Home',
    components: {
      DxHeader,
      DxFooter,
      HomeBanner,
      HomePopular,
      HomeProfessional,
      HomeTalent,
      HomeGoals
    },
    data () {
      return {
        bannerList: [],
        popularList: [],
        professionList: [],
        talentList: []
      }
    },
    computed: {},
    methods: {
      // 获取轮播
      getBannerList () {
        this.$axios.get('/website/home/getRotationPic')
          .then((res) => {
            res = res.data
            if (res.code === 200) {
              this.bannerList = res.data
            }
          })
      },
      // 获取热门专业
      getPopularList () {
        this.$axios.get('/website/home/getTypeInfo/4')
          .then((res) => {
            res = res.data
            if (res.code === 200) {
              this.popularList = res.data
            }
          })
      },
      // 获取专业人才
      getProfessionList () {
        this.$axios.get('/website/home/getProfessionTalent')
          .then((res) => {
            res = res.data
            if (res.code === 200) {
              this.professionList = res.data
            }
          })
      },
      // 获取热门人才
      getTalentList () {
        this.$axios.get('/website/home/getHotTalent')
          .then((res) => {
            res = res.data
            if (res.code === 200) {
              this.talentList = res.data[0]
            }
          })
      }
    },
    mounted () {
    },
    activated () {
      this.getBannerList()
      this.getPopularList()
      this.getProfessionList()
      this.getTalentList()
    }
  }
</script>
